REM *************************  ADC ************************
REM This is the Script file of ADC
REM Project: SL203
REM Version: 0.010
REM Release Date: 2011/08/29
REM Author: WeiLee
REM v0.0010: Init Version. Port from S9E14
REM *******************************************************

REM *** Check flash cover ***
10 FOREIGN Ret = Flash_CheckCover2()
20 IF Ret == 0 THEN 30 ELSE 60
30 LET lcdprint = "Open Flash Cover"
40 SYSTEM ScreenString(10,60,lcdprint)
50 SYSTEM delay_us(10000)
55 GOTO 10

REM *** Delete All ***
REM ******************

60 LET lcdprint = "Delete all Start"
62 SYSTEM ScreenString(10,70,lcdprint)
64 SYSTEM delay_us(1000000)
66 LET deleteresult = 0
68 FOREIGN deleteresult = FM_DeleteAllFileObjectHandle(0)
70 LET lcdprint = "Delete all End"
72 SYSTEM ScreenString(10,100,lcdprint)
74 SYSTEM delay_us(2000000)



REM ------S9E14 setting-----
100 LET Ret = 0
150 FOREIGN  BatteryGaugeEnable(0)
200 LET lcdprint = "SL203 ADC"
300 SYSTEM ScreenString(10,70,lcdprint)
400 SYSTEM delay_us(1000000)
500 FOREIGN Ret = BatteryCalibrateAD(473,454,492)
550 SYSTEM delay_us(1000000)

1000 IF Ret == 0 THEN 1300
REM *****Fail case*****
1050 FOREIGN DrawBackColor(0, 0, 0, 0, 255, 0, 0, 0)
1100 LET Str = "Battery calibration fail!"
1150 FOREIGN Ret = OneCard_FlgSet(0)
1190 FOREIGN KeyReview(0)
1200 FOREIGN Ret = OneCard_ErrPrint(Str)
1250 END

REM *****Pass case*****
REM ------Strobe test-------
1300 LET lcdprint = "Strobe test start"
1400 SYSTEM ScreenString(10,70,lcdprint)
1500 SYSTEM delay_us(1000000)
1550 SYSTEM FlashFire(79)
1800 FOREIGN Ret = OneCard_FlgSet(1)
1900 FOREIGN OneCardTest(1)
1920 SYSTEM delay_us(1500000)
2000 FOREIGN RET=PowerOff(0,0) 
2100 END

10000 END

RUN

